package com.cmc.cloud.cmclink.doc.strategy;

import com.cmc.cloud.cmclink.doc.enums.PrintStatusEnum;
import com.cmc.cloud.cmclink.doc.strategy.impl.*;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

/**
 * 策略工厂
 *
 * @author 刘艳平
 */
@Component
public class DocumentObjectivesStrategyFactory {
    private final Map<PrintStatusEnum, DocumentObjectivesStrategy> strategyMap;

    public DocumentObjectivesStrategyFactory() {
        strategyMap = new HashMap<>();
        strategyMap.put(PrintStatusEnum.DRAFTBL, new DraftBlStrategy());
        strategyMap.put(PrintStatusEnum.PREVIEWBL, new PreviewBlStrategy());
        strategyMap.put(PrintStatusEnum.PRINTBL, new PrintnoBlStrategy());
        strategyMap.put(PrintStatusEnum.PRINTATT, new PrintAttStrategy());
    }

    /**
     * 根据打印状态获取对应的策略
     *
     * @param status 打印状态
     * @return 文档目标策略
     */
    public DocumentObjectivesStrategy getStrategy(PrintStatusEnum status) {
        return strategyMap.get(status);
    }
}